import java.util.ArrayList;
import java.util.List;

public class Day4 {
    public static void main(String[] args) {
        char ch = 'b';
        System.out.println((char)(ch-32));
    }
    //784.字母大小写全排序
    List<String> ret = new ArrayList<>();
    StringBuilder str = new StringBuilder();
    public List<String> letterCasePermutation(String s) {
        dfs(s,0);
        return ret;
    }
    public void dfs(String s,int pos) {
        if(str.length() == s.length()) {
            ret.add(str.toString());
            return;
        }
        //1.递归第一部分
        str.append(s.charAt(pos));
        dfs(s,pos+1);
        str.deleteCharAt(str.length()-1);
        //2.递归大小写
        if( !('0'<= s.charAt(pos) && s.charAt(pos)<='9') ) {
            char ch;
            if('a'<=s.charAt(pos) && s.charAt(pos) <='z') {
                ch = (char)(s.charAt(pos)-32);
            }else {
                ch = (char)(s.charAt(pos)+32);
            }
            str.append(ch);
            dfs(s,pos+1);
            str.deleteCharAt(str.length()-1);
        }
    }
    //526.优美的队列
    int count;
    //List<Integer> path = new ArrayList<>();
    int s;
    boolean[] check;
    public int countArrangement(int n) {
        if(n==1) return 1;
        check = new boolean[n+1];
        dfs(n,1);
        return count;
    }
    public void dfs(int n,int pos) {
        if(s == n) {
            count++;
            return;
        }
        //i就是perm[i]的内容,pos代表下标
        for(int i=1;i<=n;i++) {
            if(check[i] == false) {
                if( i%pos == 0 || pos%i == 0) {
                    s++;
                    check[i] = true;
                    dfs(n,pos+1);
                    //回溯
                    s--;
                    check[i] = false;
                }
            }
        }
    }
    //174.地下城游戏
    public int calculateMinimumHP(int[][] dungeon) {
        int m = dungeon.length;
        int n = dungeon[0].length;
        //dp[i][j]表示
        int[][] dp = new int[m][n];
        dp[m-1][n-1] = Math.max(0,-dungeon[m-1][n-1])+1;
        //初始化最后一行
        for(int i=n-2;i>=0;i--)
            dp[m-1][i] = Math.max(1,dp[m-1][i+1]-dungeon[m-1][i]);
        for(int i=m-2;i>=0;i--)
            dp[i][n-1] = Math.max(1,dp[i+1][n-1]-dungeon[i][n-1]);
        //
        for(int i=m-2;i>=0;i--) {
            for(int j=n-2;j>=0;j--) {
                dp[i][j] = Math.max(1,Math.min(dp[i][j+1]-dungeon[i][j],dp[i+1][j]-dungeon[i][j]));
            }
        }
        return dp[0][0];
    }
}
